home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 35 / Amiga Format AFCD35 (Issue 119, Jan 1999).iso / -in_the_mag- / reader_requests / fredobbutils / bbsrc / showregs.s < prev    next >
Text File  |  1998-11-06  |  3KB  |  184 lines

  1. * Bootblock Spécial:    ShowRegs
  2. * par Frédo    (Déc.94)
  3. *
  4. * Affiche le contenu des registres CPU au moment du boot
  5. *
  6. * Displays CPU registers' contents at boot time. (Not of great use!!)
  7. * Coded a long time ago... NOT system friendly (trashes memory)
  8. *
  9.     rsreset
  10. gfxbase    rs.l    1
  11. MaxRow    rs.w    1
  12. MaxCol    rs.w    1
  13. Ysize    rs.w    1
  14. Xsize    rs.w    1
  15. cnt    rs.w    1
  16. ctrflag    rs.b    1
  17. VARSIZE    rs.w    0
  18.  
  19. Start:    dc.b    "DOS",0
  20.     dc.l    0
  21.     dc.l    $370    ;rootblock
  22. BLKBUF=$70000
  23. REGS=BLKBUF-(16*4)
  24. CIBLE=BLKBUF+$200
  25. DATA=BLKBUF
  26. Xstart=10
  27.  
  28. Main:
  29.     movem.l    d0-a6,REGS
  30.     movem.l    d0-a6,-(sp)
  31.     lea    VARS(pc),a5
  32.     move.l    4.w,a6
  33.     move.l    $9c(a6),gfxbase(a5)
  34. ShowRegs:
  35.     lea    REGS,a0
  36.     lea    DATA,a1
  37.     moveq    #15,d0
  38. .cop    move.l    (a0)+,(a1)+
  39.     dbf    d0,.cop
  40.     move.l    sp,(a1)+
  41.     move    sr,(a1)+
  42.     bsr.w    DoFmt
  43.     lea    CIBLE,a0
  44.     move.l    a0,a1
  45.     add    cnt(a5),a1
  46.     move.l    a1,d5        ;ptr dest
  47. Guru:
  48.     movem.l    d5/a0/a1,-(sp)
  49.     lea    intname(pc),a1
  50.     move.l    4.w,a6
  51.     jsr    -408(a6)
  52.     movem.l    (sp)+,d5/a0/a1
  53.     tst.l    d0
  54.     beq.w    Init
  55.     move.l    d0,a6
  56.  
  57.     move.l    gfxbase(a5),a2
  58.     move.l    216(a2),MaxRow(a5)
  59.     move.l    154(a2),a2
  60.     move    20(a2),Ysize(a5)
  61.     move    24(a2),Xsize(a5)
  62.  
  63. * Construire la mise en page des données texte
  64. build
  65.     moveq    #Xstart,d0    ;position X de départ
  66.     moveq    #12,d1        ;pos Y de départ
  67.     clr.l    d2
  68. .bcl
  69.     clr.b    (a1)+
  70.     move.l    a1,a2
  71.     move.b    d0,(a1)+
  72.     move.b    d1,(a1)+
  73.     add    Ysize(a5),d1    ;proch. ligne
  74.     clr.b    ctrflag(a5)
  75. .coptx
  76.     move.b    (a0)+,d7
  77.     tst.b    d7        ;0=fin
  78.     beq.b    .end
  79.     cmp.b    #$a,d7        ;linefeed?
  80.     beq.b    .nxt
  81.     cmp.b    #1,d7        ;centrer le texte?
  82.     bne.b    .put
  83.     st    ctrflag(a5)    ;set flag
  84.     bra.b    .coptx
  85. .put
  86.     move.b    d7,(a1)+    ;copier octet
  87.     add    Xsize(a5),d2    ;ajter x pixels (1 caract.)
  88.     bra.b    .coptx
  89. .nxt
  90.     bsr.b    Centre
  91.     clr.b    (a1)+
  92.     move.b    #1,(a1)+
  93.     bra.b    .bcl
  94. .end
  95.     bsr.b    Centre
  96.     clr.b    (a1)+        ;0 de fin
  97.  
  98. * Produire l'alerte
  99. myalert
  100.     move.l    d5,a0
  101.     moveq    #0,d0        ;n°alerte
  102. ;    clr.l    d1
  103. ;    move    MaxRow(a5),d1    ;Hauteur fenètre
  104.     jsr    -90(a6)        ;DisplayAlert()
  105.     tst.l    d0
  106.     bne.b    Reset
  107.  
  108. myCloseAll
  109.     move.l    a6,a1
  110.     move.l    4.w,a6
  111.     jsr    -414(a6)
  112.  
  113.     bra.b    Init
  114.  
  115. * Copier des données
  116. Copy    move.b    (a0)+,(a1)+
  117.     dbf    d0,Copy
  118.     rts
  119. Reset    move.l    #$f80000,$80.w
  120.     trap    #0
  121.  
  122. * Centrer le texte
  123. * <--    a2: adresse où on reportera la nouvelle Xpos
  124. *     d2: nbre de caractères de la ligne
  125. Centre
  126.     tst.b    ctrflag(a5)    ;flag posé?
  127.     beq.b    .f        ;si non, alors exit
  128.     sub    MaxCol(a5),d2
  129.     not    d2
  130.     asr    #1,d2        ;div. /2
  131.     move.b    d2,(a2)        ;reporter Xpos
  132.     clr.l    d2
  133. .f    rts
  134.  
  135. * Convertir avec RawDoFmt()
  136. * <-- a0: format string
  137. *    a1: adr des données à convertir
  138. *    a3: adr buffer cible
  139. DoFmt:
  140.     movem.l    d0-a6,-(sp)
  141.     lea    VARS(pc),a5
  142.     clr    cnt(a5)
  143.     clr    d7
  144.     lea    format(pc),a0
  145.     lea    DATA,a1
  146.     lea    .put(pc),a2
  147.     lea    CIBLE,a3
  148.     move.l    4.w,a6
  149.     jsr    -522(a6)    ;RawDoFmt()
  150.     move    d7,cnt(a5)
  151.     movem.l    (sp)+,d0-a6
  152.     rts
  153. .put    move.b    d0,(a3)+
  154.     addq    #1,d7
  155.     rts
  156.  
  157. Init:
  158.     movem.l    (sp)+,d0-a6
  159.     lea    dosname(pc),a1
  160.     move.l    4.w,a6
  161.     jsr    -96(a6)
  162.     tst.l    d0
  163.     beq.b    .err
  164.     move.l    d0,a0
  165.     move.l    22(a0),a0
  166.     moveq    #0,d0
  167.     rts
  168. .err    moveq    #-1,d0
  169.     rts
  170.  
  171.     even
  172. VARS:        dcb.b VARSIZE,0
  173. intname:    dc.b "intuition.library",0
  174. gfxname:    dc.b "graphics.library",0
  175. dosname:    dc.b "dos.library",0
  176.  
  177. format:        dc.b 1,"--- Contenu des Registres ---",$a,$a
  178.         dc.b "d0: %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx",$a
  179.         dc.b "a0: %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx",$a
  180.         dc.b 1,"USP=%08lx SR=%04x",$a,$a
  181.         dc.b 1,"LEFT = Reset  <Click Mouse>  Abort = RIGHT",0
  182. End:
  183.  blk.b 512*2,0
  184.